import { createApp } from 'vue'
import { createPinia } from 'pinia'

import VueVirtualScroller from 'vue-virtual-scroller'
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'

import 'amfe-flexible'
import 'amfe-flexible/index.js'

// import 'flv.js'
import 'xgplayer-flv'
import 'xgplayer/dist/index.min.css'

import vant from 'vant'
import 'vant/lib/index.css'

import ElementPlus from 'element-plus'
import zhCn from 'element-plus/es/locale/lang/zh-cn'
import 'element-plus/dist/index.css'

import '@/styles/main.less'
import '@/styles/theme.less'

import '@/assets/fonts/live-icon/iconfont.css'

import router from './router'

import App from './App.vue'
import SvgIcon from './components/svg-icon/index'

import { userMobile } from './utils/index'

const app = createApp(App)
const pinia = createPinia()

const isMobile = userMobile()

app.provide('isMobile', isMobile)

app.config.globalProperties.$isMobile = isMobile

app
  .use(vant)
  .use(ElementPlus, {
    locale: zhCn
  })
  .use(VueVirtualScroller)
  .use(pinia)
  .use(router)
  .use(SvgIcon)
  .mount('#app')

// 添加调试工具
import VConsole from 'vconsole'

if (process.env.NODE_ENV === 'development' && isMobile) {
  new VConsole()
}
